#include "cyassl/ctaocrypt/sha512.h"
#include <stdio.h>
#include <string.h>
#include "cyassl/ctaocrypt/random.h"

void print_buffer(byte* buff, ulong size)
{
    int i;
    for(i=0; i < size; i++)
    {
    	printf("%c",buff[i]);
    }
}

void print_hash(byte* hash)
{
    int i;
    printf("\nSHA-512 Hash:\n");

    for(i = 0; i < SHA512_DIGEST_SIZE; i++)
    {
            printf("%02x",hash[i]);
    }
}

int main(void)
{
	byte shaSum[SHA512_DIGEST_SIZE];

	byte buffer[10] = {'A', 'L', 'I', ' ', 'S' ,'A' , 'J', 'J', 'A' , 'D'};

	printf("%lu\n", sizeof(buffer));

	print_buffer(buffer, sizeof(buffer));

    Sha512 sha;

    InitSha512(&sha);

   	Sha512Update(&sha, buffer, sizeof(buffer));  // can be called again and again

   	Sha512Final(&sha, shaSum);

    print_hash(shaSum);

	return 0;

}
